package com.film.dao.impl;

import java.util.List;

import org.springframework.jdbc.core.JdbcTemplate;

import com.film.dao.FilmOfficeDao;
import com.film.domain.FilmOffice;
import com.film.rowMapper.FilmOfficeRowMapper;
import com.film.util.DBUtil;

public class FilmOfficeDaoImpl implements FilmOfficeDao{
	
	private JdbcTemplate temp = new JdbcTemplate(DBUtil.getDataScorse());
	
	@Override
	public List<FilmOffice> selectAllOffice() {
		String sql = "select * from film_office";
		return temp.query(sql, new FilmOfficeRowMapper());
	}
	
	@Override
	public List<FilmOffice> selectOffice(int officeId) {
		String sql = "select * from film_office where off_id = ?";
		return temp.query(sql, new FilmOfficeRowMapper(),officeId);
	}

}
